﻿using System;
using UnityEngine;
using UnityEngine.UI;

public class ButtonHandler : MonoBehaviour
{
    public AnimatorManager animatorManager;
    public Button button;
    public GameObject OpenPage;



    public  void Start()
    {
      
        button=transform.GetComponent<Button>();
        button.onClick.AddListener(PlayAnimation);
        animatorManager.OnAnimationCompleteEvent += HandleAnimationComplete;


    }

    private void PlayAnimation()
    {
        animatorManager.PlayAnimation();
    }

    private void HandleAnimationComplete()
    {
       // UIManager.Instance.OpenUIElement(OpenPage);
    }





    /// <summary>
    /// 重写动画完成后的处理逻辑
    /// </summary>
    //protected override void OnAnimationComplete()
    //{
    //    base.OnAnimationComplete();
    //    // 自定义逻辑
    //    Debug.Log("Custom logic after animation completes!");

    //    UIManager.Instance.OpenUIElement(OpenPage);


    //}
}